/*  This file is part of YATracker.
    YATracker is free software: you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
    YATracker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with
YATracker. If not, see <http://www.gnu.org/licenses/>. */

#include <QtGui/QApplication>
#include <QMessageBox>
#include <QSettings>
#include "main.h"
#include "mainwindow.h"


MainWindow *g_MainWindow;
QSettings *g_Settings;


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSettings settings(QSettings::IniFormat, QSettings::UserScope, "YATracker", "YATracker");
    g_Settings = &settings;

    MainWindow w;
    g_MainWindow = &w;

    w.restoreSettings();

    w.show();

    int result = a.exec();

    settings.sync();

    return result;
}

MainWindow* Global_getMainWindow()
{
    return g_MainWindow;
}
QSettings* Global_getSettings()
{
    return g_Settings;
}

void alertInfo(const QString &message)
{
    QMessageBox::information(Global_getMainWindow(), "YATracker", message);
}
void alertWarn(const QString &message)
{
    QMessageBox::warning(Global_getMainWindow(), "YATracker", message);
}
